(function(c,b,a,d){c.fn.kkstarratings=function(e){c.fn.kkstarratings.options=c.extend({ajaxurl:null,nonce:null,func:null,grs:false,msg:"Rate this post",fuelspeed:400,thankyou:"Thank you for rating.",error_msg:"An error occured.",tooltip:true,tooltips:{0:{tip:"Poor",color:"red"},1:{tip:"Fair",color:"brown"},2:{tip:"Average",color:"orange"},3:{tip:"Good",color:"blue"},4:{tip:"Excellent",color:"green"}}},c.fn.kkstarratings.options,e?e:{});var f=[];this.each(function(){f.push(c(this))});c.fn.kkstarratings.fetch(f,0,"0%",c.fn.kkstarratings.options.msg,true);return this.each(function(){})};c.fn.kkstarratings.animate=function(g){if(!g.hasClass("disabled")){var f=c(".kksr-legend",g).html(),e=c(".kksr-fuel",g).css("width");c(".kksr-stars a",g).hover(function(){var h=c(this).attr("href").split("#")[1];if(c.fn.kkstarratings.options.tooltip!=0){if(c.fn.kkstarratings.options.tooltips[h-1]!=null){c(".kksr-legend",g).html(''+c.fn.kkstarratings.options.tooltips[h-1].tip+"")}else{c(".kksr-legend",g).html(f)}}c(".kksr-fuel",g).stop(true,true).css("width","0%");c(".kksr-stars a",g).each(function(j,k){var i=c(this),l=i.attr("href").split("#")[1];if(parseInt(l)<=parseInt(h)){c(".kksr-stars a",g).stop(true,true);i.hide().addClass("kksr-star").addClass("orange").fadeIn("fast")}})},function(){c(".kksr-stars a",g).removeClass("kksr-star").removeClass("orange");if(c.fn.kkstarratings.options.tooltip!=0){c(".kksr-legend",g).html(f)}c(".kksr-fuel",g).stop(true,true).animate({width:e},c.fn.kkstarratings.options.fuelspeed)}).unbind("click").click(function(){return c.fn.kkstarratings.click(g,c(this).attr("href").split("#")[1])})}else{c(".kksr-stars a",g).unbind("click").click(function(){return false})}};c.fn.kkstarratings.update=function(h,e,g,f,i){if(f=="true"){c(".kksr-fuel",h).removeClass("yellow").addClass("orange")}c(".kksr-fuel",h).stop(true,true).animate({width:e},c.fn.kkstarratings.options.fuelspeed,"linear",function(){if(f=="true"){h.addClass("disabled");c(".kksr-stars a",h).unbind("hover")}if(!c.fn.kkstarratings.options.grs||!i){c(".kksr-legend",h).stop(true,true).hide().html(g?g:c.fn.kkstarratings.options.msg).fadeIn("slow",function(){c.fn.kkstarratings.animate(h)})}else{c.fn.kkstarratings.animate(h)}})};c.fn.kkstarratings.click=function(h,e){c(".kksr-stars a",h).unbind("hover").unbind("click").removeClass("kksr-star").removeClass("orange").click(function(){return false});var g=c(".kksr-legend",h).html(),f=c(".kksr-fuel",h).css("width");c.fn.kkstarratings.fetch(h,e,f,g,false);return false};c.fn.kkstarratings.fetch=function(g,e,i,h,j){var f=[];c.each(g,function(){f.push(c(this).attr("data-id"))});c.ajax({url:c.fn.kkstarratings.options.ajaxurl,data:"action="+c.fn.kkstarratings.options.func+"&id="+f+"&stars="+e+"&_wpnonce="+c.fn.kkstarratings.options.nonce,type:"post",dataType:"json",beforeSend:function(){c(".kksr-fuel",g).animate({width:"0%"},c.fn.kkstarratings.options.fuelspeed);if(e){c(".kksr-legend",g).fadeOut("fast",function(){c(".kksr-legend",g).html(''+c.fn.kkstarratings.options.thankyou+"")}).fadeIn("slow")}},success:function(k){c.each(g,function(){var m=c(this),l=m.attr("data-id");if(k[l].success){c.fn.kkstarratings.update(m,k[l].fuel+"%",k[l].legend,k[l].disable,j)}else{c.fn.kkstarratings.update(m,i,h,false,j)}})},complete:function(){},error:function(k){c(".kksr-legend",g).fadeOut("fast",function(){c(".kksr-legend",g).html(''+c.fn.kkstarratings.options.error_msg+"")}).fadeIn("slow",function(){c.fn.kkstarratings.update(g,i,h,false,j)})}})};c.fn.kkstarratings.options={ajaxurl:bhittani_plugin_kksr_js.ajaxurl,func:bhittani_plugin_kksr_js.func,nonce:bhittani_plugin_kksr_js.nonce,grs:bhittani_plugin_kksr_js.grs,tooltip:bhittani_plugin_kksr_js.tooltip,tooltips:bhittani_plugin_kksr_js.tooltips,msg:bhittani_plugin_kksr_js.msg,fuelspeed:bhittani_plugin_kksr_js.fuelspeed,thankyou:bhittani_plugin_kksr_js.thankyou,error_msg:bhittani_plugin_kksr_js.error_msg}})(jQuery,window,document);jQuery(document).ready(function(a){a(".kk-star-ratings").kkstarratings()});
var woodiscuzValidator=(function($){
var message, tests, checkField, validate, mark, unmark, field, minmax, defaults,
validateWords, lengthRange, lengthLimit, pattern, alertTxt, data,
email_illegalChars=/[\(\)\<\>\,\;\:\\\/\"\[\]]/,
email_filter=/^.+@.+\..{2,50}$/;
message={
invalid: 'invalid input',
empty: 'please put something here',
min: 'input is too short',
max: 'input is too long',
number_min: 'too low',
number_max: 'too high',
url: 'invalid URL',
number: 'not a number',
email: 'email address is invalid',
email_repeat: 'emails do not match',
password_repeat: 'passwords do not match',
repeat: 'no match',
complete: 'input is not complete',
select: 'Please select an option'
};
if(!window.console){
console={};
console.log=console.warn=function(){
return;
}}
defaults={alerts: true};
tests={
sameAsPlaceholder: function(a){
return $.fn.placeholder&&a.attr('placeholder')!==undefined&&data.val==a.prop('placeholder');
},
hasValue: function(a){
if(!a){
alertTxt=message.empty;
return false;
}
return true;
},
linked: function(a, b){
if(b!=a){
alertTxt=message[data.type + '_repeat']||message.no_match;
return false;
}
return true;
},
email: function(a){
if(!email_filter.test(a)||a.match(email_illegalChars)){
alertTxt=a ? message.email:message.empty;
return false;
}
return true;
},
text: function(a){
if(validateWords){
var words=a.split(' ');
var wordsLength=function(len){
for (var w=words.length; w--;)
if(words[w].length < len)
return false;
return true;
};
if(words.length < validateWords||!wordsLength(2)){
alertTxt=message.complete;
return false;
}
return true;
}
if(lengthRange&&a.length < lengthRange[0]){
alertTxt=message.min;
return false;
}
if(lengthRange&&lengthRange[1]&&a.length > lengthRange[1]){
alertTxt=message.max;
return false;
}
if(lengthLimit&&lengthLimit.length){
var obeyLimit=false;
while (lengthLimit.length){
if(lengthLimit.pop()==a.length)
obeyLimit=true;
}
if(!obeyLimit){
alertTxt=message.complete;
return false;
}}
if(pattern){
var regex, jsRegex;
switch (pattern){
case 'alphanumeric' :
regex=/^[a-z0-9]+$/i;
break;
case 'numeric' :
regex=/^[0-9]+$/i;
break;
case 'phone' :
regex=/^\+?([0-9]|[-|' '])+$/i;
break;
default :
regex=pattern;
}
try {
jsRegex=new RegExp(regex).test(a);
if(a&&!jsRegex)
return false;
}
catch (err){
console.log(err, field, 'regex is invalid');
return false;
}}
return true;
},
number: function(a){
if(isNaN(parseFloat(a))&&!isFinite(a)){
alertTxt=message.number;
return false;
}
else if(lengthRange&&a.length < lengthRange[0]){
alertTxt=message.min;
return false;
}
else if(lengthRange&&lengthRange[1]&&a.length > lengthRange[1]){
alertTxt=message.max;
return false;
}
else if(minmax[0]&&(a | 0) < minmax[0]){
alertTxt=message.number_min;
return false;
}
else if(minmax[1]&&(a | 0) > minmax[1]){
alertTxt=message.number_max;
return false;
}
return true;
},
date: function(a){
var day, A=a.split(/[-./]/g), i;
if(field[0].valueAsNumber)
return true;
for (i=A.length; i--;){
if(isNaN(parseFloat(a))&&!isFinite(a))
return false;
}
try {
day=new Date(A[2], A[1] - 1, A[0]);
if(day.getMonth() + 1==A[1]&&day.getDate()==A[0])
return day;
return false;
}
catch (er){
console.log('date test: ', err);
return false;
}},
url: function(a){
function testUrl(url){
return /^(https?:\/\/)?([\w\d\-_]+\.+[A-Za-z]{2,})+\/?/.test(url);
}
if(!testUrl(a)){
console.log(a);
alertTxt=a ? message.url:message.empty;
return false;
}
return true;
},
hidden: function(a){
if(lengthRange&&a.length < lengthRange[0]){
alertTxt=message.min;
return false;
}
if(pattern){
var regex;
if(pattern=='alphanumeric'){
regex=/^[a-z0-9]+$/i;
if(!regex.test(a)){
return false;
}}
}
return true;
},
select: function(a){
if(!tests.hasValue(a)){
alertTxt=message.select;
return false;
}
return true;
}};
mark=function(field, text){
if(!text||!field||!field.length)
return false;
var item=field.parents('.woodiscuz-item'),
warning;
if(item.hasClass('bad')){
if(defaults.alerts)
item.find('.alert').html(text);
}
else if(defaults.alerts){
warning=$('
').html(text);
item.append(warning);
}
item.removeClass('bad');
setTimeout(function(){
item.addClass('bad');
}, 0);
};
unmark=function(field){
if(!field||!field.length){
console.warn('no "field" argument, null or DOM object not found');
return false;
}
field.parents('.woodiscuz-item')
.removeClass('bad')
.find('.alert').remove();
};
function testByType(type, value){
if(type=='tel')
pattern=pattern||'phone';
if(!type||type=='password'||type=='tel')
type='text';
return tests[type](value);
}
function prepareFieldData(el){
field=$(el);
field.data('valid', true);
field.data('type', field.attr('type'));
pattern=field.attr('pattern');
}
function keypress(e){
prepareFieldData(this);
if(e.charCode)
return testByType(this.type, String.fromCharCode(e.charCode));
}
function checkField(){
if(this.type!='hidden'&&$(this).is(':hidden'))
return true;
prepareFieldData(this);
field.data('val', field[0].value.replace(/^\s+|\s+$/g, ""));
data=field.data();
alertTxt=message[field.prop('name')]||message.invalid;
if(field[0].nodeName.toLowerCase()==="select"){
data.type='select';
}
if(field[0].nodeName.toLowerCase()==="textarea"){
data.type='text';
}
validateWords=data['validateWords']||0;
lengthRange=data['validateLengthRange'] ? (data['validateLengthRange'] + '').split(','):[1];
lengthLimit=data['validateLength'] ? (data['validateLength'] + '').split(','):false;
minmax=data['validateMinmax'] ? (data['validateMinmax'] + '').split(','):'';
data.valid=tests.hasValue(data.val);
if(data.valid){
if(tests.sameAsPlaceholder(field)){
alertTxt=message.empty;
data.valid=false;
}
if(data.validateLinked){
var linkedTo=data['validateLinked'].indexOf('#')==0 ? $(data['validateLinked']):$(':input[name=' + data['validateLinked'] + ']');
data.valid=tests.linked(data.val, linkedTo.val());
}
else if(data.valid||data.type=='select')
data.valid=testByType(data.type, data.val);
if(field.hasClass('optional')&&!data.val)
data.valid=true;
}
if(data.valid)
unmark(field);
else {
mark(field, alertTxt);
submit=false;
}
return data.valid;
}
function checkAll($form){
$form=$($form);
if($form.length==0){
console.warn('element not found');
return false;
}
var that=this,
submit=true,
fieldsToCheck=$form.find(':input').filter('[required=required], .required, .optional').not('[disabled=disabled]');
fieldsToCheck.each(function(){
submit=submit * checkField.apply(this);
});
return !!submit;
}
return {
defaults: defaults,
checkField: checkField,
keypress: keypress,
checkAll: checkAll,
mark: mark,
unmark: unmark,
message: message,
tests: tests
}})(jQuery);
jQuery(document).ready(function ($){
var wpc_home_url=$('#wpc_home_url').val();
var wpc_plugin_dir_url=$('#wpc_plugin_dir_url').val();
var wpc_name;
var wpc_email;
var wpc_comment;
var wpc_captcha;
var wpc_comment_post_ID;
var wpc_comment_parent;
var wpc_form;
var wpc_submitID;
var wpc_comments_offset;
var wpc_new_comment_id;
var wpc_loading_image;
var wpc_comment_text_before_editting;
$(".wpc_comment").autoGrow();
$(document).on('click', '#wpc_openModalFormAction', function (){
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
});
$(document).on('click', '#wpc_openModalFormAction .close', function (){
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
});
wpc_loading_image="
";
wpc_comments_offset=$('#wpc_comments_offset');
wpc_comments_offset.val('1');
$(document).on('focus', '.wpc_comment', function (){
var uniqueID=getUniqueID($(this));
$('#wpc-form-footer-' + uniqueID).slideDown(700);
});
$(document).on('click', '.wpc-reply-link', function (){
var uniqueID=getUniqueID($(this));
$('#wpc-secondary-forms-wrapper-' + uniqueID).slideToggle(700);
});
$(document).on('click', '.wpc-share-link', function (){
var uniqueID=getUniqueID($(this));
$('#share_buttons_box-' + uniqueID).slideToggle(1000);
});
$(document).on('click', '.wpc_captcha_refresh_img', function (){
var uniqueID=getUniqueID($(this));
var wpc_commpost_ID=$('#wpc_comment_post_ID-' + uniqueID).val();
var wpc_commparent=$('#wpc_comment_parent-' + uniqueID).val();
$("#wpc_captcha_img-" + uniqueID).attr("src", wpc_home_url + "/" + wpc_plugin_dir_url + "/captcha/captcha.php?comm_id=" + wpc_commpost_ID + '-' + wpc_commparent + '&r=' + Math.random());
});
$(document).on('click', '.wpc_comm_submit', function (){
wpc_submitID=$(this).attr('id');
var uniqueID=wpc_submitID.substring(wpc_submitID.lastIndexOf('-') + 1);
wpc_name=$('#wpc_name-' + uniqueID).val();
wpc_email=$('#wpc_email-' + uniqueID).val();
wpc_comment=$('textarea#wpc_comment-' + uniqueID).val();
wpc_captcha=$('#wpc_captcha-' + uniqueID).val();
wpc_comment_post_ID=$('#wpc_comment_post_ID-' + uniqueID).val();
wpc_comment_parent=$('#wpc_comment_parent-' + uniqueID).val();
wpc_form=$('#wpc_comm_form-' + uniqueID);
var depth='';
if(isMainFormSubmit(wpc_submitID, wpc_comment_post_ID)){
depth=1;
}else{
depth=getCommentDepth($(this).parents('.wpc-comment'));
}
var submit=true;
if(!woodiscuzValidator.checkAll(wpc_form)){
submit=false;
$('#wpc_captcha-' + uniqueID).val('');
$("#wpc_captcha_img-" + uniqueID).attr("src", wpc_home_url + "/" + wpc_plugin_dir_url + "/captcha/captcha.php?comm_id=" + wpc_comment_post_ID + '-' + wpc_comment_parent + '&r=' + Math.random());
}else{
$('#wpc_openModalFormAction .close').css('display', 'none');
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
$('#wpc_openModalFormAction > #wpc_response_info').html(wpc_loading_image);
}
var notification_type='';
var notification_type_radio=$("input[name='wpc_notification_new_reply-" + uniqueID + "']:checked").length ? $("input[name='wpc_notification_new_reply-" + uniqueID + "']:checked").val():'';
if(notification_type_radio.length){
if(notification_type_radio=='wpc_notification_new_reply'){
notification_type='reply';
}}
if(submit){
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
name: wpc_name,
email: wpc_email,
comment: wpc_comment,
captcha: wpc_captcha,
comment_depth: depth,
comment_post_ID: wpc_comment_post_ID,
comment_parent: wpc_comment_parent,
notification_type: notification_type,
action: 'wpc_comms_via_ajax'
}}).done(function (response){
$("#wpc_captcha_img-" + uniqueID).attr("src", wpc_home_url + "/" + wpc_plugin_dir_url + "/captcha/captcha.php?comm_id=" + wpc_comment_post_ID + '-' + wpc_comment_parent + '&r=' + Math.random());
var obj=$.parseJSON(response);
wpc_new_comment_id=parseInt(obj.wpc_new_comment_id);
if(obj.code===-1){
$('#wpc_response_info').html(obj.message);
}else if(obj.code===-2){
var html="
";
$('#wpc_response_info').html(html + obj.message);
$('#wpc_openModalFormAction .close').css('display', 'block');
$('#wpc_comment-' + uniqueID).val('');
$('.wpc_comm_form textarea').css('height', '46px');
if(wpc_submitID==='wpc_comm-' + wpc_comment_post_ID + '_0'){
$('#wpc-form-footer-' + uniqueID).slideToggle(700);
}else{
$('#wpc-secondary-forms-wrapper-' + uniqueID).slideToggle(700);
}
$.cookie('wpc_author_name', wpc_name);
$.cookie('wpc_author_email', wpc_email);
$.cookie('wpc_poster', wpc_email, 60 * 60 * 24 * 365 * 10);
}else{
$('#wpc_comment-' + uniqueID).val('');
$('.wpc_comm_form textarea').css('height', '46px');
if(wpc_submitID==='wpc_comm-' + wpc_comment_post_ID + '_0'){
$('.wpc-thread-wrapper').prepend(obj.message);
$('#wpc-form-footer-' + uniqueID).slideToggle(700);
}else{
$('#wpc-secondary-forms-wrapper-' + uniqueID).slideToggle(700);
if(obj.is_in_same_container==1){
$('#wpc-secondary-forms-wrapper-' + uniqueID).after(obj.message);
}else{
$('#wpc-secondary-forms-wrapper-' + uniqueID).after(obj.message.replace('wpc-reply', 'wpc-reply wpc-no-left-margin'));
}}
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
if(wpc_name!==''&&wpc_email!==''){
$.cookie('wpc_author_name', wpc_name);
$.cookie('wpc_author_email', wpc_email);
$('#woopcomm .wpc_name').val(wpc_name);
$('#woopcomm .wpc_email').val(wpc_email);
}
$.cookie('wpc_poster', wpc_email, 60 * 60 * 24 * 365 * 10);
if(wpc_new_comment_id!==-1){
notify_on_new_comment(wpc_comment_post_ID, wpc_new_comment_id, wpc_email);
}}
$('#wpc_captcha-' + uniqueID).val('');
$('.wpc_tooltipster').tooltipster({offsetY: 2,multiple:true});
$('.wpc_comm_form input').css('box-shadow', '0 0 4px -2px #d4d0ba');
$('.wpc_comm_form textarea').css('box-shadow', '0 0 4px -2px #d4d0ba');
if((obj.code==1||obj.code==-2)&&$('form.wpc_main_form').hasClass('wpc-no-comments')){
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
wpc_new_comment_id: wpc_new_comment_id,
action: 'woodiscuz_comment_redirect'
}}).done(function (redirectResponse){
try {
var redirectObj=$.parseJSON(redirectResponse);
if(redirectObj.code==1){
setTimeout(function (){
window.location.href=redirectObj.redirect_to;
}, 5000)
}} catch (e){
}});
}});
}else{
return false;
}});
$(document).on('click', '.wpc_vote', function (){
var uniqueID=getUniqueID($(this));
var commentID=getCommentID(uniqueID);
var voteType;
$('#wpc_openModalFormAction > #wpc_response_info').html(wpc_loading_image);
$('#wpc_openModalFormAction .close').css('display', 'block');
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
if($(this).hasClass('wpc-up')){
voteType=1;
}else{
voteType=-1;
}
$.ajax({
dateType: 'json',
type: 'POST',
url: wpc_ajax_obj.url,
data: {
comment_ID: commentID,
vote_type: voteType,
action: 'wpc_vote_via_ajax'
}}).done(function (response){
var obj=$.parseJSON(response);
if(obj.code!==-1){
$('#vote-count-' + uniqueID).text(parseInt($('#vote-count-' + uniqueID).text()) + voteType);
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
}else{
var html="
";
$('#wpc_response_info').html(html + obj.message);
$('#wpc_openModalFormAction .close').css('display', 'block');
}});
});
$(document).on('click', '.wpc-load-more-submit', function (){
$('#wpc_openModalFormAction > #wpc_response_info').html(wpc_loading_image);
$('#wpc_openModalFormAction .close').css('display', 'none');
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
var wpc_comments_offset_value=wpc_comments_offset.val();
var wpc_post_id=getPostID($(this).attr('id'));
var wpc_parent_comments_count=parseInt($('#wpc_parent_comments_count').val());
var wpc_parent_per_page=parseInt($('#wpc_parent_per_page').val());
wpc_comments_offset_value=parseInt(wpc_comments_offset_value);
wpc_comments_offset_value++;
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
comments_offset: wpc_comments_offset_value,
wpc_post_id: wpc_post_id,
action: 'wpc_load_more_comments'
}}).done(function (response){
wpc_comments_offset.val(wpc_comments_offset_value);
if(wpc_parent_comments_count <=(wpc_comments_offset_value * wpc_parent_per_page)){
$('.wpc-load-more-submit-wrap').remove();
}
$('.wpc-thread-wrapper').html(response);
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
$('.wpc_tooltipster').tooltipster({offsetY: 2});
});
});
function getUniqueID(field){
var fieldID=field.attr('id');
var uniqueID=fieldID.substring(fieldID.lastIndexOf('-') + 1);
return uniqueID;
}
function getPostID(uniqueID){
var postID=uniqueID.substring(uniqueID.lastIndexOf('-') + 1);
postID=postID.substring(0, postID.lastIndexOf('_'));
return postID;
}
function getCommentID(uniqueID){
var commentID=uniqueID.substring(uniqueID.indexOf('_') + 1);
return commentID;
}
function notify_on_new_comment(post_id, comment_id, email){
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
wpc_post_id: post_id,
wpc_comment_id: comment_id,
wpc_email: email,
action: 'wpc_check_notification_type'
}});
}
$(document).on('click', '.wpc_editable_comment', function (){
var uniqueID=getUniqueID($(this));
var commentID=getCommentID(uniqueID);
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
comment_id: commentID,
action: 'wpc_get_editable_comment_content'
}}).done(function (response){
try {
var obj=$.parseJSON(response);
if(obj.code==1){
wpc_comment_text_before_editting=obj.message;
var editableTextarea='';
$('#wpc-comm-' + uniqueID + ' > .wpc-comment-right .wpc-comment-text').replaceWith(editableTextarea);
document.getElementById('wpc_edit_comment-' + uniqueID).trigger('focus');
$('#wpc_save_edited_comment-' + uniqueID).show();
editableTextarea='';
$('#wpc_editable_comment-' + uniqueID).hide();
$('#wpc_cancel_edit-' + uniqueID).show();
}else{
var html="
";
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
$('#wpc_openModalFormAction .close').css('display', 'block');
$('#wpc_openModalFormAction > #wpc_response_info').html(html + obj.phrase_message);
}} catch (e){
console.log(e);
}});
});
$(document).on('click', '.wpc_save_edited_comment', function (){
var uniqueID=getUniqueID($(this));
var commentID=getCommentID(uniqueID);
var editableTextarea=$('#wpc-comm-' + uniqueID + ' textarea#wpc_edit_comment-' + uniqueID);
var commentContent=editableTextarea.val();
var submit=true;
if($.trim(commentContent).length <=0){
submit=false;
}
if(submit){
$('#wpc_openModalFormAction .close').css('display', 'none');
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
$('#wpc_openModalFormAction > #wpc_response_info').html(wpc_loading_image);
$.ajax({
type: 'POST',
url: wpc_ajax_obj.url,
data: {
comment_id: commentID,
comment_content: commentContent,
action: 'wpc_save_edited_comment'
}}).done(function (response){
try {
var obj=$.parseJSON(response);
if(obj.code==1){
$('#wpc_openModalFormAction').css('opacity', '0');
$('#wpc_openModalFormAction').css('pointer-events', 'none');
wpc_cancel_or_save(uniqueID, obj.message);
}else{
var html="
";
$('#wpc_openModalFormAction').css('opacity', '1');
$('#wpc_openModalFormAction').css('pointer-events', 'auto');
$('#wpc_openModalFormAction .close').css('display', 'block');
$('#wpc_openModalFormAction > #wpc_response_info').html(html + obj.phrase_message);
}
editableTextarea='';
commentContent='';
} catch (e){
console.log(e);
}});
}});
$(document).on('click', '.wpc_cancel_edit', function (){
var uniqueID=getUniqueID($(this));
wpc_cancel_or_save(uniqueID, wpc_comment_text_before_editting);
});
function wpc_cancel_or_save(uniqueID, content){
$('#wpc_editable_comment-' + uniqueID).show();
$('#wpc_cancel_edit-' + uniqueID).hide();
$('#wpc_save_edited_comment-' + uniqueID).hide();
var commentContentWrapper='';
$('#wpc-comm-' + uniqueID + ' #wpc_edit_comment-' + uniqueID).replaceWith(commentContentWrapper);
}
function nl2br(str, is_xhtml){
var breakTag=(is_xhtml||typeof is_xhtml==='undefined') ? '
':'
';
var string=(str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
return string.replace('
', '
');
}
function getCommentDepth(field){
var fieldClasses=field.attr('class');
var classesArray=fieldClasses.split(' ');
var depth='';
$.each(classesArray, function (index, value){
;
if('wpc_comment_level'===getParentDepth(value, false)){
depth=getParentDepth(value, true);
}});
return parseInt(depth) + 1;
}
function getParentDepth(depthValue, isNumberPart){
var depth='';
if(isNumberPart){
depth=depthValue.substring(depthValue.indexOf('-') + 1);
}else{
depth=depthValue.substring(0, depthValue.indexOf('-'));
}
return depth;
}
function isMainFormSubmit(wpc_submitID, wpc_comment_post_ID){
return wpc_submitID==='wpc_comm-' + wpc_comment_post_ID + '_0';
}
$('.wpc_tooltipster').tooltipster({offsetY: 2});
});
(function (factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else if(typeof exports==='object'){
factory(require('jquery'));
}else{
factory(jQuery);
}}(function ($){
var pluses=/\+/g;
function encode(s){
return config.raw ? s:encodeURIComponent(s);
}
function decode(s){
return config.raw ? s:decodeURIComponent(s);
}
function stringifyCookieValue(value){
return encode(config.json ? JSON.stringify(value):String(value));
}
function parseCookieValue(s){
if(s.indexOf('"')===0){
s=s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
s=decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s):s;
} catch(e){}}
function read(s, converter){
var value=config.raw ? s:parseCookieValue(s);
return $.isFunction(converter) ? converter(value):value;
}
var config=$.cookie=function (key, value, options){
if(value!==undefined&&!$.isFunction(value)){
options=$.extend({}, config.defaults, options);
if(typeof options.expires==='number'){
var days=options.expires, t=options.expires=new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie=[
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString():'',
options.path ? '; path=' + options.path:'',
options.domain ? '; domain=' + options.domain:'',
options.secure ? '; secure':''
].join(''));
}
var result=key ? undefined:{};
var cookies=document.cookie ? document.cookie.split('; '):[];
for (var i=0, l=cookies.length; i < l; i++){
var parts=cookies[i].split('=');
var name=decode(parts.shift());
var cookie=parts.join('=');
if(key&&key===name){
result=read(cookie, value);
break;
}
if(!key&&(cookie=read(cookie))!==undefined){
result[name]=cookie;
}}
return result;
};
config.defaults={};
$.removeCookie=function (key, options){
if($.cookie(key)===undefined){
return false;
}
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};}));
;(function(e,t,n){function s(t,n){this.bodyOverflowX;this.callbacks={hide:[],show:[]};this.checkInterval=null;this.Content;this.$el=e(t);this.$elProxy;this.elProxyPosition;this.enabled=true;this.options=e.extend({},i,n);this.mouseIsOverProxy=false;this.namespace="tooltipster-"+Math.round(Math.random()*1e5);this.Status="hidden";this.timerHide=null;this.timerShow=null;this.$tooltip;this.options.iconTheme=this.options.iconTheme.replace(".","");this.options.theme=this.options.theme.replace(".","");this._init()}function o(t,n){var r=true;e.each(t,function(e,i){if(typeof n[e]==="undefined"||t[e]!==n[e]){r=false;return false}});return r}function f(){return!a&&u}function l(){var e=n.body||n.documentElement,t=e.style,r="transition";if(typeof t[r]=="string"){return true}v=["Moz","Webkit","Khtml","O","ms"],r=r.charAt(0).toUpperCase()+r.substr(1);for(var i=0;i
');t.$elProxy.text(t.options.icon)}else{if(t.options.iconCloning)t.$elProxy=t.options.icon.clone(true);else t.$elProxy=t.options.icon}t.$elProxy.insertAfter(t.$el)}else{t.$elProxy=t.$el}if(t.options.trigger=="hover"){t.$elProxy.on("mouseenter."+t.namespace,function(){if(!f()||t.options.touchDevices){t.mouseIsOverProxy=true;t._show()}}).on("mouseleave."+t.namespace,function(){if(!f()||t.options.touchDevices){t.mouseIsOverProxy=false}});if(u&&t.options.touchDevices){t.$elProxy.on("touchstart."+t.namespace,function(){t._showNow()})}}else if(t.options.trigger=="click"){t.$elProxy.on("click."+t.namespace,function(){if(!f()||t.options.touchDevices){t._show()}})}}},_show:function(){var e=this;if(e.Status!="shown"&&e.Status!="appearing"){if(e.options.delay){e.timerShow=setTimeout(function(){if(e.options.trigger=="click"||e.options.trigger=="hover"&&e.mouseIsOverProxy){e._showNow()}},e.options.delay)}else e._showNow()}},_showNow:function(n){var r=this;r.options.functionBefore.call(r.$el,r.$el,function(){if(r.enabled&&r.Content!==null){if(n)r.callbacks.show.push(n);r.callbacks.hide=[];clearTimeout(r.timerShow);r.timerShow=null;clearTimeout(r.timerHide);r.timerHide=null;if(r.options.onlyOne){e(".tooltipstered").not(r.$el).each(function(t,n){var r=e(n),i=r.data("tooltipster-ns");e.each(i,function(e,t){var n=r.data(t),i=n.status(),s=n.option("autoClose");if(i!=="hidden"&&i!=="disappearing"&&s){n.hide()}})})}var i=function(){r.Status="shown";e.each(r.callbacks.show,function(e,t){t.call(r.$el)});r.callbacks.show=[]};if(r.Status!=="hidden"){var s=0;if(r.Status==="disappearing"){r.Status="appearing";if(l()){r.$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-"+r.options.animation+"-show");if(r.options.speed>0)r.$tooltip.delay(r.options.speed);r.$tooltip.queue(i)}else{r.$tooltip.stop().fadeIn(i)}}else if(r.Status==="shown"){i()}}else{r.Status="appearing";var s=r.options.speed;r.bodyOverflowX=e("body").css("overflow-x");e("body").css("overflow-x","hidden");var o="tooltipster-"+r.options.animation,a="-webkit-transition-duration: "+r.options.speed+"ms; -webkit-animation-duration: "+r.options.speed+"ms; -moz-transition-duration: "+r.options.speed+"ms; -moz-animation-duration: "+r.options.speed+"ms; -o-transition-duration: "+r.options.speed+"ms; -o-animation-duration: "+r.options.speed+"ms; -ms-transition-duration: "+r.options.speed+"ms; -ms-animation-duration: "+r.options.speed+"ms; transition-duration: "+r.options.speed+"ms; animation-duration: "+r.options.speed+"ms;",f=r.options.minWidth?"min-width:"+Math.round(r.options.minWidth)+"px;":"",c=r.options.maxWidth?"max-width:"+Math.round(r.options.maxWidth)+"px;":"",h=r.options.interactive?"pointer-events: auto;":"";r.$tooltip=e('');if(l())r.$tooltip.addClass(o);r._content_insert();r.$tooltip.appendTo("body");r.reposition();r.options.functionReady.call(r.$el,r.$el,r.$tooltip);if(l()){r.$tooltip.addClass(o+"-show");if(r.options.speed>0)r.$tooltip.delay(r.options.speed);r.$tooltip.queue(i)}else{r.$tooltip.css("display","none").fadeIn(r.options.speed,i)}r._interval_set();e(t).on("scroll."+r.namespace+" resize."+r.namespace,function(){r.reposition()});if(r.options.autoClose){e("body").off("."+r.namespace);if(r.options.trigger=="hover"){if(u){setTimeout(function(){e("body").on("touchstart."+r.namespace,function(){r.hide()})},0)}if(r.options.interactive){if(u){r.$tooltip.on("touchstart."+r.namespace,function(e){e.stopPropagation()})}var p=null;r.$elProxy.add(r.$tooltip).on("mouseleave."+r.namespace+"-autoClose",function(){clearTimeout(p);p=setTimeout(function(){r.hide()},r.options.interactiveTolerance)}).on("mouseenter."+r.namespace+"-autoClose",function(){clearTimeout(p)})}else{r.$elProxy.on("mouseleave."+r.namespace+"-autoClose",function(){r.hide()})}}else if(r.options.trigger=="click"){setTimeout(function(){e("body").on("click."+r.namespace+" touchstart."+r.namespace,function(){r.hide()})},0);if(r.options.interactive){r.$tooltip.on("click."+r.namespace+" touchstart."+r.namespace,function(e){e.stopPropagation()})}}}}if(r.options.timer>0){r.timerHide=setTimeout(function(){r.timerHide=null;r.hide()},r.options.timer+s)}}})},_interval_set:function(){var t=this;t.checkInterval=setInterval(function(){if(e("body").find(t.$el).length===0||e("body").find(t.$elProxy).length===0||t.Status=="hidden"||e("body").find(t.$tooltip).length===0){if(t.Status=="shown"||t.Status=="appearing")t.hide();t._interval_cancel()}else{if(t.options.positionTracker){var n=t._repositionInfo(t.$elProxy),r=false;if(o(n.dimension,t.elProxyPosition.dimension)){if(t.$elProxy.css("position")==="fixed"){if(o(n.position,t.elProxyPosition.position))r=true}else{if(o(n.offset,t.elProxyPosition.offset))r=true}}if(!r){t.reposition()}}}},200)},_interval_cancel:function(){clearInterval(this.checkInterval);this.checkInterval=null},_content_set:function(e){if(typeof e==="object"&&e!==null&&this.options.contentCloning){e=e.clone(true)}this.Content=e},_content_insert:function(){var e=this,t=this.$tooltip.find(".tooltipster-content");if(typeof e.Content==="string"&&!e.options.contentAsHTML){t.text(e.Content)}else{t.empty().append(e.Content)}},_update:function(e){var t=this;t._content_set(e);if(t.Content!==null){if(t.Status!=="hidden"){t._content_insert();t.reposition();if(t.options.updateAnimation){if(l()){t.$tooltip.css({width:"","-webkit-transition":"all "+t.options.speed+"ms, width 0ms, height 0ms, left 0ms, top 0ms","-moz-transition":"all "+t.options.speed+"ms, width 0ms, height 0ms, left 0ms, top 0ms","-o-transition":"all "+t.options.speed+"ms, width 0ms, height 0ms, left 0ms, top 0ms","-ms-transition":"all "+t.options.speed+"ms, width 0ms, height 0ms, left 0ms, top 0ms",transition:"all "+t.options.speed+"ms, width 0ms, height 0ms, left 0ms, top 0ms"}).addClass("tooltipster-content-changing");setTimeout(function(){if(t.Status!="hidden"){t.$tooltip.removeClass("tooltipster-content-changing");setTimeout(function(){if(t.Status!=="hidden"){t.$tooltip.css({"-webkit-transition":t.options.speed+"ms","-moz-transition":t.options.speed+"ms","-o-transition":t.options.speed+"ms","-ms-transition":t.options.speed+"ms",transition:t.options.speed+"ms"})}},t.options.speed)}},t.options.speed)}else{t.$tooltip.fadeTo(t.options.speed,.5,function(){if(t.Status!="hidden"){t.$tooltip.fadeTo(t.options.speed,1)}})}}}}else{t.hide()}},_repositionInfo:function(e){return{dimension:{height:e.outerHeight(false),width:e.outerWidth(false)},offset:e.offset(),position:{left:parseInt(e.css("left")),top:parseInt(e.css("top"))}}},hide:function(n){var r=this;if(n)r.callbacks.hide.push(n);r.callbacks.show=[];clearTimeout(r.timerShow);r.timerShow=null;clearTimeout(r.timerHide);r.timerHide=null;var i=function(){e.each(r.callbacks.hide,function(e,t){t.call(r.$el)});r.callbacks.hide=[]};if(r.Status=="shown"||r.Status=="appearing"){r.Status="disappearing";var s=function(){r.Status="hidden";if(typeof r.Content=="object"&&r.Content!==null){r.Content.detach()}r.$tooltip.remove();r.$tooltip=null;e(t).off("."+r.namespace);e("body").off("."+r.namespace).css("overflow-x",r.bodyOverflowX);e("body").off("."+r.namespace);r.$elProxy.off("."+r.namespace+"-autoClose");r.options.functionAfter.call(r.$el,r.$el);i()};if(l()){r.$tooltip.clearQueue().removeClass("tooltipster-"+r.options.animation+"-show").addClass("tooltipster-dying");if(r.options.speed>0)r.$tooltip.delay(r.options.speed);r.$tooltip.queue(s)}else{r.$tooltip.stop().fadeOut(r.options.speed,s)}}else if(r.Status=="hidden"){i()}return r},show:function(e){this._showNow(e);return this},update:function(e){return this.content(e)},content:function(e){if(typeof e==="undefined"){return this.Content}else{this._update(e);return this}},reposition:function(){var n=this;if(e("body").find(n.$tooltip).length!==0){n.$tooltip.css("width","");n.elProxyPosition=n._repositionInfo(n.$elProxy);var r=null,i=e(t).width(),s=n.elProxyPosition,o=n.$tooltip.outerWidth(false),u=n.$tooltip.innerWidth()+1,a=n.$tooltip.outerHeight(false);if(n.$elProxy.is("area")){var f=n.$elProxy.attr("shape"),l=n.$elProxy.parent().attr("name"),c=e('img[usemap="#'+l+'"]'),h=c.offset().left,p=c.offset().top,d=n.$elProxy.attr("coords")!==undefined?n.$elProxy.attr("coords").split(","):undefined;if(f=="circle"){var v=parseInt(d[0]),m=parseInt(d[1]),g=parseInt(d[2]);s.dimension.height=g*2;s.dimension.width=g*2;s.offset.top=p+m-g;s.offset.left=h+v-g}else if(f=="rect"){var v=parseInt(d[0]),m=parseInt(d[1]),y=parseInt(d[2]),b=parseInt(d[3]);s.dimension.height=b-m;s.dimension.width=y-v;s.offset.top=p+m;s.offset.left=h+v}else if(f=="poly"){var w=[],E=[],S=0,x=0,T=0,N=0,C="even";for(var k=0;kT){T=L;if(k===0){S=T}}if(LN){N=L;if(k==1){x=N}}if(Li){r=A-(i+n-o);A=i+n-o}}function B(n,r){if(s.offset.top-e(t).scrollTop()-a-_-12<0&&r.indexOf("top")>-1){P=n}if(s.offset.top+s.dimension.height+a+12+_>e(t).scrollTop()+e(t).height()&&r.indexOf("bottom")>-1){P=n;M=s.offset.top-a-_-12}}if(P=="top"){var j=s.offset.left+o-(s.offset.left+s.dimension.width);A=s.offset.left+D-j/2;M=s.offset.top-a-_-12;H();B("bottom","top")}if(P=="top-left"){A=s.offset.left+D;M=s.offset.top-a-_-12;H();B("bottom-left","top-left")}if(P=="top-right"){A=s.offset.left+s.dimension.width+D-o;M=s.offset.top-a-_-12;H();B("bottom-right","top-right")}if(P=="bottom"){var j=s.offset.left+o-(s.offset.left+s.dimension.width);A=s.offset.left-j/2+D;M=s.offset.top+s.dimension.height+_+12;H();B("top","bottom")}if(P=="bottom-left"){A=s.offset.left+D;M=s.offset.top+s.dimension.height+_+12;H();B("top-left","bottom-left")}if(P=="bottom-right"){A=s.offset.left+s.dimension.width+D-o;M=s.offset.top+s.dimension.height+_+12;H();B("top-right","bottom-right")}if(P=="left"){A=s.offset.left-D-o-12;O=s.offset.left+D+s.dimension.width+12;var F=s.offset.top+a-(s.offset.top+s.dimension.height);M=s.offset.top-F/2-_;if(A<0&&O+o>i){var I=parseFloat(n.$tooltip.css("border-width"))*2,q=o+A-I;n.$tooltip.css("width",q+"px");a=n.$tooltip.outerHeight(false);A=s.offset.left-D-q-12-I;F=s.offset.top+a-(s.offset.top+s.dimension.height);M=s.offset.top-F/2-_}else if(A<0){A=s.offset.left+D+s.dimension.width+12;r="left"}}if(P=="right"){A=s.offset.left+D+s.dimension.width+12;O=s.offset.left-D-o-12;var F=s.offset.top+a-(s.offset.top+s.dimension.height);M=s.offset.top-F/2-_;if(A+o>i&&O<0){var I=parseFloat(n.$tooltip.css("border-width"))*2,q=i-A-I;n.$tooltip.css("width",q+"px");a=n.$tooltip.outerHeight(false);F=s.offset.top+a-(s.offset.top+s.dimension.height);M=s.offset.top-F/2-_}else if(A+o>i){A=s.offset.left-D-o-12;r="right"}}if(n.options.arrow){var R="tooltipster-arrow-"+P;if(n.options.arrowColor.length<1){var U=n.$tooltip.css("background-color")}else{var U=n.options.arrowColor}if(!r){r=""}else if(r=="left"){R="tooltipster-arrow-right";r=""}else if(r=="right"){R="tooltipster-arrow-left";r=""}else{r="left:"+Math.round(r)+"px;"}if(P=="top"||P=="top-left"||P=="top-right"){var z=parseFloat(n.$tooltip.css("border-bottom-width")),W=n.$tooltip.css("border-bottom-color")}else if(P=="bottom"||P=="bottom-left"||P=="bottom-right"){var z=parseFloat(n.$tooltip.css("border-top-width")),W=n.$tooltip.css("border-top-color")}else if(P=="left"){var z=parseFloat(n.$tooltip.css("border-right-width")),W=n.$tooltip.css("border-right-color")}else if(P=="right"){var z=parseFloat(n.$tooltip.css("border-left-width")),W=n.$tooltip.css("border-left-color")}else{var z=parseFloat(n.$tooltip.css("border-bottom-width")),W=n.$tooltip.css("border-bottom-color")}if(z>1){z++}var X="";if(z!==0){var V="",J="border-color: "+W+";";if(R.indexOf("bottom")!==-1){V="margin-top: -"+Math.round(z)+"px;"}else if(R.indexOf("top")!==-1){V="margin-bottom: -"+Math.round(z)+"px;"}else if(R.indexOf("left")!==-1){V="margin-right: -"+Math.round(z)+"px;"}else if(R.indexOf("right")!==-1){V="margin-left: -"+Math.round(z)+"px;"}X=''}n.$tooltip.find(".tooltipster-arrow").remove();var K=''+X+'
';n.$tooltip.append(K)}n.$tooltip.css({top:Math.round(M)+"px",left:Math.round(A)+"px"})}return n},enable:function(){this.enabled=true;return this},disable:function(){this.hide();this.enabled=false;return this},destroy:function(){var t=this;t.hide();if(t.$el[0]!==t.$elProxy[0])t.$elProxy.remove();t.$el.removeData(t.namespace).off("."+t.namespace);var n=t.$el.data("tooltipster-ns");if(n.length===1){var r=typeof t.Content==="string"?t.Content:e("").append(t.Content).html();t.$el.removeClass("tooltipstered").attr("title",r).removeData(t.namespace).removeData("tooltipster-ns").off("."+t.namespace)}else{n=e.grep(n,function(e,n){return e!==t.namespace});t.$el.data("tooltipster-ns",n)}return t},elementIcon:function(){return this.$el[0]!==this.$elProxy[0]?this.$elProxy[0]:undefined},elementTooltip:function(){return this.$tooltip?this.$tooltip[0]:undefined},option:function(e,t){if(typeof t=="undefined")return this.options[e];else{this.options[e]=t;return this}},status:function(){return this.Status}};e.fn[r]=function(){var t=arguments;if(this.length===0){if(typeof t[0]==="string"){var n=true;switch(t[0]){case"setDefaults":e.extend(i,t[1]);break;default:n=false;break}if(n)return true;else return this}else{return this}}else{if(typeof t[0]==="string"){var r="#*$~&";this.each(function(){var n=e(this).data("tooltipster-ns"),i=n?e(this).data(n[0]):null;if(i){if(typeof i[t[0]]==="function"){var s=i[t[0]](t[1],t[2])}else{throw new Error('Unknown method .tooltipster("'+t[0]+'")')}if(s!==i){r=s;return false}}else{throw new Error("You called Tooltipster's \""+t[0]+'" method on an uninitialized element')}});return r!=="#*$~&"?r:this}else{var o=[],u=t[0]&&typeof t[0].multiple!=="undefined",a=u&&t[0].multiple||!u&&i.multiple,f=t[0]&&typeof t[0].debug!=="undefined",l=f&&t[0].debug||!f&&i.debug;this.each(function(){var n=false,r=e(this).data("tooltipster-ns"),i=null;if(!r){n=true}else if(a){n=true}else if(l){console.log('Tooltipster: one or more tooltips are already attached to this element: ignoring. Use the "multiple" option to attach more tooltips.')}if(n){i=new s(this,t[0]);if(!r)r=[];r.push(i.namespace);e(this).data("tooltipster-ns",r);e(this).data(i.namespace,i)}o.push(i)});if(a)return o;else return this}}};var u=!!("ontouchstart"in t);var a=false;e("body").one("mousemove",function(){a=true})})(jQuery,window,document);
jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">").replace(/\n/g,"
")+".
.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};
var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
(function ($){
'use strict';
$(function (){
toggleCalculator();
$(document).on('keyup', '.iptCep', function (e){
jQuery('.observation-shipping-free').hide();
resetarTabela();
if($(this).val().length===9){
if($(e.target).is('a#cfpp_credits')){ return; }
var url=$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_endpoint_url').val();
var cep=$('.iptCep').val();
var id_produto=$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #id_produto').val();
var errors=[];
if(errors.length > 0){
var row='';
row='Ocorreu um erro ao obter informações sobre o valor do frete |
';
errors.map(item=> {
row +=`${item} |
`;
});
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
esconderLoader();
exibirTabela();
return false;
}
let inpCEP=$(this);
inpCEP.attr('disabled', 'disabled');
exibirLoader();
esconderTabela();
resetarTabela();
let qty=1;
let inpQty=$('.quantity .qty:visible').val();
if(typeof inpQty!='undefined'){
qty=inpQty;
}
$.ajax({
url: url,
type: "POST",
data: {
'action': 'cotation_product_page',
'data': {
'cep_origem': cep,
'id_produto': id_produto,
'quantity': qty
}},
error: function (jqXHR, exception){
inpCEP.removeAttr('disabled');
inpCEP.val('');
alert(jqXHR.responseJSON.error);
esconderLoader();
esconderTabela();
resetarTabela();
return false;
},
success: function (response){
$('#destiny-shipping-mehor-envio').text('Frete para ' + response.data.destination);
var row='';
let data=response.data.quotations;
data.map(item=> {
if(item.observations&&item.observations!=='Frete Grátis'){
jQuery('.observation-shipping-free').show();
jQuery('.observation-shipping-free').html(item.observations);
}
let name=item.name
if(!item.delivery_time){
item.delivery_time='';
}
row +=`${name} ${item.delivery_time}: ${item.price} |
`;
});
if(row==''){
row='Desculpe, o cálculo de frete para este produto só está disponível no Carrinho, por favor, prossiga com a compra normalmente. |
';
}
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').append(row);
esconderLoader();
exibirTabela();
inpCEP.removeAttr('disabled');
inpCEP.val('');
}});
}})
function exibirLoader(){
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'none');
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'flex');
}
function esconderLoader(){
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete').css('display', 'inline-block');
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calcular-frete-loader').css('display', 'none');
}
function exibirTabela(){
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').show();
}
function esconderTabela(){
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete').hide();
}
function resetarTabela(){
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto .resultado-frete table tbody').html('');
$('#destiny-shipping-mehor-envio').text('');
}
$(".single_variation_wrap").on("show_variation", function (event, variation){
resetarTabela();
esconderTabela();
$('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_preco').val(variation.display_price.toFixed(2));
});
});
})(jQuery);
(function (jQuery){
'use strict';
jQuery(function (){
jQuery(document).ready(function (){
toggleCalculator();
setProduct();
if(!jQuery('.variations_form')){
return;
}
let variations=jQuery('.variations_form').data('product_variations');
updateVariation(variations);
jQuery('.variations select').change(function (){
setProduct();
updateVariation(variations);
});
})
});
function setProduct(){
setTimeout(function(){
let variantion_id=jQuery('.variation_id').val();
let product_id=jQuery('.cart').data('product_id');
let selected_product=variantion_id;
if(variantion_id==0){
selected_product=product_id;
}
if(typeof product_id!="undefined"&&typeof variantion_id!="undefined")
jQuery('#id_produto').val(selected_product)
}, 200);
}
function updateVariation(variations){
let attribbutes=new Array();
if(jQuery('.variations select').length==0){
return;
}
jQuery('.variations select').each(function (){
let key=jQuery(this).attr('data-attribute_name');
let value=this.value;
if(value==""){
return;
}
attribbutes.push({
'key': key,
'value': value
});
});
if(typeof attribbutes=='undefined'||attribbutes.length==0){
resetFormData();
return;
}
let selected=0;
if(jQuery('.variations select').length==attribbutes.length){
variations.map(function (variant, index){
attribbutes.map(function (attr){
if(variant.attributes[attr.key]==attr.value){
selected=index;
}});
});
}
if(typeof selected=='number'){
setFormData(variations[selected])
}}
function setFormData(variation){
if(!variation.dimensions.width ||
!variation.dimensions.height ||
!variation.dimensions.length ||
variation.dimensions.width==0 ||
variation.dimensions.height==0 ||
variation.dimensions.length==0){
resetFormData();
return;
}
jQuery('#calculo_frete_produto_altura').val(variation.dimensions.height)
jQuery('#calculo_frete_produto_largura').val(variation.dimensions.width)
jQuery('#calculo_frete_produto_comprimento').val(variation.dimensions.length)
jQuery('#calculo_frete_produto_peso').val(variation.weight)
toggleCalculator();
}
function resetFormData(){
jQuery('#id_produto').val(null)
jQuery('#calculo_frete_produto_altura').val(null)
jQuery('#calculo_frete_produto_largura').val(null)
jQuery('#calculo_frete_produto_comprimento').val(null)
jQuery('#calculo_frete_produto_peso').val(null)
toggleCalculator();
}})(jQuery);
function toggleCalculator(){
let widthProduct=document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_altura');
if(!widthProduct){
return;
}
let dimensions=getDimension();
if(!dimensions.width
|| !dimensions.heigth
|| !dimensions.length
|| !dimensions.weight
|| dimensions.width==0
|| dimensions.heigth==0
|| dimensions.length==0
|| dimensions.weight==0
){
document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto').style.display='none';
return;
}
document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto').style.display='block';
}
function getDimension(){
let dimensions={
'heigth': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_altura').value,
'width': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_largura').value,
'length': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_comprimento').value,
'weight': document.querySelector('#woocommerce-correios-calculo-de-frete-na-pagina-do-produto #calculo_frete_produto_peso').value
}
return dimensions;
}
function mascara(t, mask){
var i=t.value.length;
var carac=mask.substring(i, i+1);
var prox_char=mask.substring(i+1, i+2);
if(i==0&&carac!='#'){
insereCaracter(t, carac);
if(prox_char!='#')insereCaracter(t, prox_char);
}
else if(carac!='#'){
insereCaracter(t, carac);
if(prox_char!='#')insereCaracter(t, prox_char);
}
function insereCaracter(t, char){
t.value +=char;
}}
function validateNumber(event){
var key=window.event ? event.keyCode:event.which;
if(event.keyCode===8||event.keyCode===46){
return true;
}else if(key < 48||key > 57){
return false;
}else{
return true;
}};
if(typeof jQuery==='undefined'){
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($){
'use strict';
var version=$.fn.jquery.split(' ')[0].split('.')
if((version[0] < 2&&version[1] < 9)||(version[0]==1&&version[1]==9&&version[2] < 1)){
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
}}(jQuery);
+function ($){
'use strict';
function transitionEnd(){
var el=document.createElement('bootstrap')
var transEndEventNames={
WebkitTransition:'webkitTransitionEnd',
MozTransition:'transitionend',
OTransition:'oTransitionEnd otransitionend',
transition:'transitionend'
}
for (var name in transEndEventNames){
if(el.style[name]!==undefined){
return { end: transEndEventNames[name] }}
}
return false
}
$.fn.emulateTransitionEnd=function (duration){
var called=false
var $el=this
$(this).one('bsTransitionEnd', function (){ called=true })
var callback=function (){ if(!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function (){
$.support.transition=transitionEnd()
if(!$.support.transition) return
$.event.special.bsTransitionEnd={
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e){
if($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}}
})
}(jQuery);
+function ($){
'use strict';
var dismiss='[data-dismiss="alert"]'
var Alert=function (el){
$(el).on('click', dismiss, this.close)
}
Alert.VERSION='3.3.4'
Alert.TRANSITION_DURATION=150
Alert.prototype.close=function (e){
var $this=$(this)
var selector=$this.attr('data-target')
if(!selector){
selector=$this.attr('href')
selector=selector&&selector.replace(/.*(?=#[^\s]*$)/, '')
}
var $parent=$(selector)
if(e) e.preventDefault()
if(!$parent.length){
$parent=$this.closest('.alert')
}
$parent.trigger(e=$.Event('close.bs.alert'))
if(e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement(){
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition&&$parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.alert')
if(!data) $this.data('bs.alert', (data=new Alert(this)))
if(typeof option=='string') data[option].call($this)
})
}
var old=$.fn.alert
$.fn.alert=Plugin
$.fn.alert.Constructor=Alert
$.fn.alert.noConflict=function (){
$.fn.alert=old
return this
}
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);
+function ($){
'use strict';
var Button=function (element, options){
this.$element=$(element)
this.options=$.extend({}, Button.DEFAULTS, options)
this.isLoading=false
}
Button.VERSION='3.3.4'
Button.DEFAULTS={
loadingText: 'loading...'
}
Button.prototype.setState=function (state){
var d='disabled'
var $el=this.$element
var val=$el.is('input') ? 'val':'html'
var data=$el.data()
state=state + 'Text'
if(data.resetText==null) $el.data('resetText', $el[val]())
setTimeout($.proxy(function (){
$el[val](data[state]==null ? this.options[state]:data[state])
if(state=='loadingText'){
this.isLoading=true
$el.addClass(d).attr(d, d)
}else if(this.isLoading){
this.isLoading=false
$el.removeClass(d).removeAttr(d)
}}, this), 0)
}
Button.prototype.toggle=function (){
var changed=true
var $parent=this.$element.closest('[data-toggle="buttons"]')
if($parent.length){
var $input=this.$element.find('input')
if($input.prop('type')=='radio'){
if($input.prop('checked')&&this.$element.hasClass('active')) changed=false
else $parent.find('.active').removeClass('active')
}
if(changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}else{
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
}
if(changed) this.$element.toggleClass('active')
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.button')
var options=typeof option=='object'&&option
if(!data) $this.data('bs.button', (data=new Button(this, options)))
if(option=='toggle') data.toggle()
else if(option) data.setState(option)
})
}
var old=$.fn.button
$.fn.button=Plugin
$.fn.button.Constructor=Button
$.fn.button.noConflict=function (){
$.fn.button=old
return this
}
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e){
var $btn=$(e.target)
if(!$btn.hasClass('btn')) $btn=$btn.closest('.btn')
Plugin.call($btn, 'toggle')
e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e){
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
}(jQuery);
+function ($){
'use strict';
var Carousel=function (element, options){
this.$element=$(element)
this.$indicators=this.$element.find('.carousel-indicators')
this.options=options
this.paused=null
this.sliding=null
this.interval=null
this.$active=null
this.$items=null
this.options.keyboard&&this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause=='hover'&&!('ontouchstart' in document.documentElement)&&this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION='3.3.4'
Carousel.TRANSITION_DURATION=600
Carousel.DEFAULTS={
interval: 5000,
pause: 'hover',
wrap: true,
keyboard: true
}
Carousel.prototype.keydown=function (e){
if(/input|textarea/i.test(e.target.tagName)) return
switch (e.which){
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle=function (e){
e||(this.paused=false)
this.interval&&clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval=setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex=function (item){
this.$items=item.parent().children('.item')
return this.$items.index(item||this.$active)
}
Carousel.prototype.getItemForDirection=function (direction, active){
var activeIndex=this.getItemIndex(active)
var willWrap=(direction=='prev'&&activeIndex===0)
|| (direction=='next'&&activeIndex==(this.$items.length - 1))
if(willWrap&&!this.options.wrap) return active
var delta=direction=='prev' ? -1:1
var itemIndex=(activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to=function (pos){
var that=this
var activeIndex=this.getItemIndex(this.$active=this.$element.find('.item.active'))
if(pos > (this.$items.length - 1)||pos < 0) return
if(this.sliding) return this.$element.one('slid.bs.carousel', function (){ that.to(pos) })
if(activeIndex==pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next':'prev', this.$items.eq(pos))
}
Carousel.prototype.pause=function (e){
e||(this.paused=true)
if(this.$element.find('.next, .prev').length&&$.support.transition){
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval=clearInterval(this.interval)
return this
}
Carousel.prototype.next=function (){
if(this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev=function (){
if(this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide=function (type, next){
var $active=this.$element.find('.item.active')
var $next=next||this.getItemForDirection(type, $active)
var isCycling=this.interval
var direction=type=='next' ? 'left':'right'
var that=this
if($next.hasClass('active')) return (this.sliding=false)
var relatedTarget=$next[0]
var slideEvent=$.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if(slideEvent.isDefaultPrevented()) return
this.sliding=true
isCycling&&this.pause()
if(this.$indicators.length){
this.$indicators.find('.active').removeClass('active')
var $nextIndicator=$(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator&&$nextIndicator.addClass('active')
}
var slidEvent=$.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction })
if($.support.transition&&this.$element.hasClass('slide')){
$next.addClass(type)
$next[0].offsetWidth
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function (){
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding=false
setTimeout(function (){
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
}else{
$active.removeClass('active')
$next.addClass('active')
this.sliding=false
this.$element.trigger(slidEvent)
}
isCycling&&this.cycle()
return this
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.carousel')
var options=$.extend({}, Carousel.DEFAULTS, $this.data(), typeof option=='object'&&option)
var action=typeof option=='string' ? option:options.slide
if(!data) $this.data('bs.carousel', (data=new Carousel(this, options)))
if(typeof option=='number') data.to(option)
else if(action) data[action]()
else if(options.interval) data.pause().cycle()
})
}
var old=$.fn.carousel
$.fn.carousel=Plugin
$.fn.carousel.Constructor=Carousel
$.fn.carousel.noConflict=function (){
$.fn.carousel=old
return this
}
var clickHandler=function (e){
var href
var $this=$(this)
var $target=$($this.attr('data-target')||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, ''))
if(!$target.hasClass('carousel')) return
var options=$.extend({}, $target.data(), $this.data())
var slideIndex=$this.attr('data-slide-to')
if(slideIndex) options.interval=false
Plugin.call($target, options)
if(slideIndex){
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function (){
$('[data-ride="carousel"]').each(function (){
var $carousel=$(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
+function ($){
'use strict';
var Collapse=function (element, options){
this.$element=$(element)
this.options=$.extend({}, Collapse.DEFAULTS, options)
this.$trigger=$('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning=null
if(this.options.parent){
this.$parent=this.getParent()
}else{
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if(this.options.toggle) this.toggle()
}
Collapse.VERSION='3.3.4'
Collapse.TRANSITION_DURATION=350
Collapse.DEFAULTS={
toggle: true
}
Collapse.prototype.dimension=function (){
var hasWidth=this.$element.hasClass('width')
return hasWidth ? 'width':'height'
}
Collapse.prototype.show=function (){
if(this.transitioning||this.$element.hasClass('in')) return
var activesData
var actives=this.$parent&&this.$parent.children('.panel').children('.in, .collapsing')
if(actives&&actives.length){
activesData=actives.data('bs.collapse')
if(activesData&&activesData.transitioning) return
}
var startEvent=$.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented()) return
if(actives&&actives.length){
Plugin.call(actives, 'hide')
activesData||actives.data('bs.collapse', null)
}
var dimension=this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning=1
var complete=function (){
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning=0
this.$element
.trigger('shown.bs.collapse')
}
if(!$.support.transition) return complete.call(this)
var scrollSize=$.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide=function (){
if(this.transitioning||!this.$element.hasClass('in')) return
var startEvent=$.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented()) return
var dimension=this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning=1
var complete=function (){
this.transitioning=0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if(!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle=function (){
this[this.$element.hasClass('in') ? 'hide':'show']()
}
Collapse.prototype.getParent=function (){
return $(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element){
var $element=$(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass=function ($element, $trigger){
var isOpen=$element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger){
var href
var target=$trigger.attr('data-target')
|| (href=$trigger.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, '')
return $(target)
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.collapse')
var options=$.extend({}, Collapse.DEFAULTS, $this.data(), typeof option=='object'&&option)
if(!data&&options.toggle&&/show|hide/.test(option)) options.toggle=false
if(!data) $this.data('bs.collapse', (data=new Collapse(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.collapse
$.fn.collapse=Plugin
$.fn.collapse.Constructor=Collapse
$.fn.collapse.noConflict=function (){
$.fn.collapse=old
return this
}
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e){
var $this=$(this)
if(!$this.attr('data-target')) e.preventDefault()
var $target=getTargetFromTrigger($this)
var data=$target.data('bs.collapse')
var option=data ? 'toggle':$this.data()
Plugin.call($target, option)
})
}(jQuery);
+function ($){
'use strict';
var backdrop='.dropdown-backdrop'
var toggle='[data-toggle="dropdown"]'
var Dropdown=function (element){
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION='3.3.4'
Dropdown.prototype.toggle=function (e){
var $this=$(this)
if($this.is('.disabled, :disabled')) return
var $parent=getParent($this)
var isActive=$parent.hasClass('open')
clearMenus()
if(!isActive){
if('ontouchstart' in document.documentElement&&!$parent.closest('.navbar-nav').length){
$('').insertAfter($(this)).on('click', clearMenus)
}
var relatedTarget={ relatedTarget: this }
$parent.trigger(e=$.Event('show.bs.dropdown', relatedTarget))
if(e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown=function (e){
if(!/(38|40|27|32)/.test(e.which)||/input|textarea/i.test(e.target.tagName)) return
var $this=$(this)
e.preventDefault()
e.stopPropagation()
if($this.is('.disabled, :disabled')) return
var $parent=getParent($this)
var isActive=$parent.hasClass('open')
if((!isActive&&e.which!=27)||(isActive&&e.which==27)){
if(e.which==27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc=' li:not(.disabled):visible a'
var $items=$parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
if(!$items.length) return
var index=$items.index(e.target)
if(e.which==38&&index > 0) index--
if(e.which==40&&index < $items.length - 1) index++
if(!~index) index=0
$items.eq(index).trigger('focus')
}
function clearMenus(e){
if(e&&e.which===3) return
$(backdrop).remove()
$(toggle).each(function (){
var $this=$(this)
var $parent=getParent($this)
var relatedTarget={ relatedTarget: this }
if(!$parent.hasClass('open')) return
$parent.trigger(e=$.Event('hide.bs.dropdown', relatedTarget))
if(e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
function getParent($this){
var selector=$this.attr('data-target')
if(!selector){
selector=$this.attr('href')
selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/, '')
}
var $parent=selector&&$(selector)
return $parent&&$parent.length ? $parent:$this.parent()
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.dropdown')
if(!data) $this.data('bs.dropdown', (data=new Dropdown(this)))
if(typeof option=='string') data[option].call($this)
})
}
var old=$.fn.dropdown
$.fn.dropdown=Plugin
$.fn.dropdown.Constructor=Dropdown
$.fn.dropdown.noConflict=function (){
$.fn.dropdown=old
return this
}
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e){ e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
}(jQuery);
+function ($){
'use strict';
var Modal=function (element, options){
this.options=options
this.$body=$(document.body)
this.$element=$(element)
this.$dialog=this.$element.find('.modal-dialog')
this.$backdrop=null
this.isShown=null
this.originalBodyPad=null
this.scrollbarWidth=0
this.ignoreBackdropClick=false
if(this.options.remote){
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function (){
this.$element.trigger('loaded.bs.modal')
}, this))
}}
Modal.VERSION='3.3.4'
Modal.TRANSITION_DURATION=300
Modal.BACKDROP_TRANSITION_DURATION=150
Modal.DEFAULTS={
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle=function (_relatedTarget){
return this.isShown ? this.hide():this.show(_relatedTarget)
}
Modal.prototype.show=function (_relatedTarget){
var that=this
var e=$.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if(this.isShown||e.isDefaultPrevented()) return
this.isShown=true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function (){
that.$element.one('mouseup.dismiss.bs.modal', function (e){
if($(e.target).is(that.$element)) that.ignoreBackdropClick=true
})
})
this.backdrop(function (){
var transition=$.support.transition&&that.$element.hasClass('fade')
if(!that.$element.parent().length){
that.$element.appendTo(that.$body)
}
that.$element
.show()
.scrollTop(0)
that.adjustDialog()
if(transition){
that.$element[0].offsetWidth
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e=$.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$dialog
.one('bsTransitionEnd', function (){
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide=function (e){
if(e) e.preventDefault()
e=$.Event('hide.bs.modal')
this.$element.trigger(e)
if(!this.isShown||e.isDefaultPrevented()) return
this.isShown=false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition&&this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus=function (){
$(document)
.off('focusin.bs.modal')
.on('focusin.bs.modal', $.proxy(function (e){
if(this.$element[0]!==e.target&&!this.$element.has(e.target).length){
this.$element.trigger('focus')
}}, this))
}
Modal.prototype.escape=function (){
if(this.isShown&&this.options.keyboard){
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e){
e.which==27&&this.hide()
}, this))
}else if(!this.isShown){
this.$element.off('keydown.dismiss.bs.modal')
}}
Modal.prototype.resize=function (){
if(this.isShown){
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
}else{
$(window).off('resize.bs.modal')
}}
Modal.prototype.hideModal=function (){
var that=this
this.$element.hide()
this.backdrop(function (){
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop=function (){
this.$backdrop&&this.$backdrop.remove()
this.$backdrop=null
}
Modal.prototype.backdrop=function (callback){
var that=this
var animate=this.$element.hasClass('fade') ? 'fade':''
if(this.isShown&&this.options.backdrop){
var doAnimate=$.support.transition&&animate
this.$backdrop=$('')
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e){
if(this.ignoreBackdropClick){
this.ignoreBackdropClick=false
return
}
if(e.target!==e.currentTarget) return
this.options.backdrop=='static'
? this.$element[0].focus()
: this.hide()
}, this))
if(doAnimate) this.$backdrop[0].offsetWidth
this.$backdrop.addClass('in')
if(!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
}else if(!this.isShown&&this.$backdrop){
this.$backdrop.removeClass('in')
var callbackRemove=function (){
that.removeBackdrop()
callback&&callback()
}
$.support.transition&&this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
}else if(callback){
callback()
}}
Modal.prototype.handleUpdate=function (){
this.adjustDialog()
}
Modal.prototype.adjustDialog=function (){
var modalIsOverflowing=this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing&&modalIsOverflowing ? this.scrollbarWidth:'',
paddingRight: this.bodyIsOverflowing&&!modalIsOverflowing ? this.scrollbarWidth:''
})
}
Modal.prototype.resetAdjustments=function (){
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar=function (){
var fullWindowWidth=window.innerWidth
if(!fullWindowWidth){
var documentElementRect=document.documentElement.getBoundingClientRect()
fullWindowWidth=documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing=document.body.clientWidth < fullWindowWidth
this.scrollbarWidth=this.measureScrollbar()
}
Modal.prototype.setScrollbar=function (){
var bodyPad=parseInt((this.$body.css('padding-right')||0), 10)
this.originalBodyPad=document.body.style.paddingRight||''
if(this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar=function (){
this.$body.css('padding-right', this.originalBodyPad)
}
Modal.prototype.measureScrollbar=function (){
var scrollDiv=document.createElement('div')
scrollDiv.className='modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth=scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
function Plugin(option, _relatedTarget){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.modal')
var options=$.extend({}, Modal.DEFAULTS, $this.data(), typeof option=='object'&&option)
if(!data) $this.data('bs.modal', (data=new Modal(this, options)))
if(typeof option=='string') data[option](_relatedTarget)
else if(options.show) data.show(_relatedTarget)
})
}
var old=$.fn.modal
$.fn.modal=Plugin
$.fn.modal.Constructor=Modal
$.fn.modal.noConflict=function (){
$.fn.modal=old
return this
}
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e){
var $this=$(this)
var href=$this.attr('href')
var $target=$($this.attr('data-target')||(href&&href.replace(/.*(?=#[^\s]+$)/, '')))
var option=$target.data('bs.modal') ? 'toggle':$.extend({ remote: !/#/.test(href)&&href }, $target.data(), $this.data())
if($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent){
if(showEvent.isDefaultPrevented()) return
$target.one('hidden.bs.modal', function (){
$this.is(':visible')&&$this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
+function ($){
'use strict';
var Tooltip=function (element, options){
this.type=null
this.options=null
this.enabled=null
this.timeout=null
this.hoverState=null
this.$element=null
this.init('tooltip', element, options)
}
Tooltip.VERSION='3.3.4'
Tooltip.TRANSITION_DURATION=150
Tooltip.DEFAULTS={
animation: true,
placement: 'top',
selector: false,
template: '',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}}
Tooltip.prototype.init=function (type, element, options){
this.enabled=true
this.type=type
this.$element=$(element)
this.options=this.getOptions(options)
this.$viewport=this.options.viewport&&$(this.options.viewport.selector||this.options.viewport)
if(this.$element[0] instanceof document.constructor&&!this.options.selector){
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers=this.options.trigger.split(' ')
for (var i=triggers.length; i--;){
var trigger=triggers[i]
if(trigger=='click'){
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
}else if(trigger!='manual'){
var eventIn=trigger=='hover' ? 'mouseenter':'focusin'
var eventOut=trigger=='hover' ? 'mouseleave':'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}}
this.options.selector ?
(this._options=$.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults=function (){
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions=function (options){
options=$.extend({}, this.getDefaults(), this.$element.data(), options)
if(options.delay&&typeof options.delay=='number'){
options.delay={
show: options.delay,
hide: options.delay
}}
return options
}
Tooltip.prototype.getDelegateOptions=function (){
var options={}
var defaults=this.getDefaults()
this._options&&$.each(this._options, function (key, value){
if(defaults[key]!=value) options[key]=value
})
return options
}
Tooltip.prototype.enter=function (obj){
var self=obj instanceof this.constructor ?
obj:$(obj.currentTarget).data('bs.' + this.type)
if(self&&self.$tip&&self.$tip.is(':visible')){
self.hoverState='in'
return
}
if(!self){
self=new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState='in'
if(!self.options.delay||!self.options.delay.show) return self.show()
self.timeout=setTimeout(function (){
if(self.hoverState=='in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave=function (obj){
var self=obj instanceof this.constructor ?
obj:$(obj.currentTarget).data('bs.' + this.type)
if(!self){
self=new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState='out'
if(!self.options.delay||!self.options.delay.hide) return self.hide()
self.timeout=setTimeout(function (){
if(self.hoverState=='out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show=function (){
var e=$.Event('show.bs.' + this.type)
if(this.hasContent()&&this.enabled){
this.$element.trigger(e)
var inDom=$.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if(e.isDefaultPrevented()||!inDom) return
var that=this
var $tip=this.tip()
var tipId=this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if(this.options.animation) $tip.addClass('fade')
var placement=typeof this.options.placement=='function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken=/\s?auto?\s?/i
var autoPlace=autoToken.test(placement)
if(autoPlace) placement=placement.replace(autoToken, '')||'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container):$tip.insertAfter(this.$element)
var pos=this.getPosition()
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(autoPlace){
var orgPlacement=placement
var $container=this.options.container ? $(this.options.container):this.$element.parent()
var containerDim=this.getPosition($container)
placement=placement=='bottom'&&pos.bottom + actualHeight > containerDim.bottom ? 'top' :
placement=='top'&&pos.top - actualHeight < containerDim.top ? 'bottom' :
placement=='right'&&pos.right + actualWidth > containerDim.width ? 'left' :
placement=='left'&&pos.left - actualWidth < containerDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset=this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete=function (){
var prevHoverState=that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState=null
if(prevHoverState=='out') that.leave(that)
}
$.support.transition&&this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}}
Tooltip.prototype.applyPlacement=function (offset, placement){
var $tip=this.tip()
var width=$tip[0].offsetWidth
var height=$tip[0].offsetHeight
var marginTop=parseInt($tip.css('margin-top'), 10)
var marginLeft=parseInt($tip.css('margin-left'), 10)
if(isNaN(marginTop)) marginTop=0
if(isNaN(marginLeft)) marginLeft=0
offset.top=offset.top + marginTop
offset.left=offset.left + marginLeft
$.offset.setOffset($tip[0], $.extend({
using: function (props){
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}}, offset), 0)
$tip.addClass('in')
var actualWidth=$tip[0].offsetWidth
var actualHeight=$tip[0].offsetHeight
if(placement=='top'&&actualHeight!=height){
offset.top=offset.top + height - actualHeight
}
var delta=this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if(delta.left) offset.left +=delta.left
else offset.top +=delta.top
var isVertical=/top|bottom/.test(placement)
var arrowDelta=isVertical ? delta.left * 2 - width + actualWidth:delta.top * 2 - height + actualHeight
var arrowOffsetPosition=isVertical ? 'offsetWidth':'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow=function (delta, dimension, isVertical){
this.arrow()
.css(isVertical ? 'left':'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top':'left', '')
}
Tooltip.prototype.setContent=function (){
var $tip=this.tip()
var title=this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html':'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide=function (callback){
var that=this
var $tip=$(this.$tip)
var e=$.Event('hide.bs.' + this.type)
function complete(){
if(that.hoverState!='in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback&&callback()
}
this.$element.trigger(e)
if(e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition&&$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState=null
return this
}
Tooltip.prototype.fixTitle=function (){
var $e=this.$element
if($e.attr('title')||typeof ($e.attr('data-original-title'))!='string'){
$e.attr('data-original-title', $e.attr('title')||'').attr('title', '')
}}
Tooltip.prototype.hasContent=function (){
return this.getTitle()
}
Tooltip.prototype.getPosition=function ($element){
$element=$element||this.$element
var el=$element[0]
var isBody=el.tagName=='BODY'
var elRect=el.getBoundingClientRect()
if(elRect.width==null){
elRect=$.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset=isBody ? { top: 0, left: 0 }:$element.offset()
var scroll={ scroll: isBody ? document.documentElement.scrollTop||document.body.scrollTop:$element.scrollTop() }
var outerDims=isBody ? { width: $(window).width(), height: $(window).height() }:null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset=function (placement, pos, actualWidth, actualHeight){
return placement=='bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement=='top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement=='left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
{ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }}
Tooltip.prototype.getViewportAdjustedDelta=function (placement, pos, actualWidth, actualHeight){
var delta={ top: 0, left: 0 }
if(!this.$viewport) return delta
var viewportPadding=this.options.viewport&&this.options.viewport.padding||0
var viewportDimensions=this.getPosition(this.$viewport)
if(/right|left/.test(placement)){
var topEdgeOffset=pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset=pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if(topEdgeOffset < viewportDimensions.top){
delta.top=viewportDimensions.top - topEdgeOffset
}else if(bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height){
delta.top=viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}}else{
var leftEdgeOffset=pos.left - viewportPadding
var rightEdgeOffset=pos.left + viewportPadding + actualWidth
if(leftEdgeOffset < viewportDimensions.left){
delta.left=viewportDimensions.left - leftEdgeOffset
}else if(rightEdgeOffset > viewportDimensions.width){
delta.left=viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}}
return delta
}
Tooltip.prototype.getTitle=function (){
var title
var $e=this.$element
var o=this.options
title=$e.attr('data-original-title')
|| (typeof o.title=='function' ? o.title.call($e[0]):o.title)
return title
}
Tooltip.prototype.getUID=function (prefix){
do prefix +=~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip=function (){
return (this.$tip=this.$tip||$(this.options.template))
}
Tooltip.prototype.arrow=function (){
return (this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable=function (){
this.enabled=true
}
Tooltip.prototype.disable=function (){
this.enabled=false
}
Tooltip.prototype.toggleEnabled=function (){
this.enabled = !this.enabled
}
Tooltip.prototype.toggle=function (e){
var self=this
if(e){
self=$(e.currentTarget).data('bs.' + this.type)
if(!self){
self=new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}}
self.tip().hasClass('in') ? self.leave(self):self.enter(self)
}
Tooltip.prototype.destroy=function (){
var that=this
clearTimeout(this.timeout)
this.hide(function (){
that.$element.off('.' + that.type).removeData('bs.' + that.type)
})
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.tooltip')
var options=typeof option=='object'&&option
if(!data&&/destroy|hide/.test(option)) return
if(!data) $this.data('bs.tooltip', (data=new Tooltip(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.tooltip
$.fn.tooltip=Plugin
$.fn.tooltip.Constructor=Tooltip
$.fn.tooltip.noConflict=function (){
$.fn.tooltip=old
return this
}}(jQuery);
+function ($){
'use strict';
var Popover=function (element, options){
this.init('popover', element, options)
}
if(!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION='3.3.4'
Popover.DEFAULTS=$.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: ''
})
Popover.prototype=$.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor=Popover
Popover.prototype.getDefaults=function (){
return Popover.DEFAULTS
}
Popover.prototype.setContent=function (){
var $tip=this.tip()
var title=this.getTitle()
var content=this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html':'text'](title)
$tip.find('.popover-content').children().detach().end()[
this.options.html ? (typeof content=='string' ? 'html':'append'):'text'
](content)
$tip.removeClass('fade top bottom left right in')
if(!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent=function (){
return this.getTitle()||this.getContent()
}
Popover.prototype.getContent=function (){
var $e=this.$element
var o=this.options
return $e.attr('data-content')
|| (typeof o.content=='function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow=function (){
return (this.$arrow=this.$arrow||this.tip().find('.arrow'))
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.popover')
var options=typeof option=='object'&&option
if(!data&&/destroy|hide/.test(option)) return
if(!data) $this.data('bs.popover', (data=new Popover(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.popover
$.fn.popover=Plugin
$.fn.popover.Constructor=Popover
$.fn.popover.noConflict=function (){
$.fn.popover=old
return this
}}(jQuery);
+function ($){
'use strict';
function ScrollSpy(element, options){
this.$body=$(document.body)
this.$scrollElement=$(element).is(document.body) ? $(window):$(element)
this.options=$.extend({}, ScrollSpy.DEFAULTS, options)
this.selector=(this.options.target||'') + ' .nav li > a'
this.offsets=[]
this.targets=[]
this.activeTarget=null
this.scrollHeight=0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION='3.3.4'
ScrollSpy.DEFAULTS={
offset: 10
}
ScrollSpy.prototype.getScrollHeight=function (){
return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh=function (){
var that=this
var offsetMethod='offset'
var offsetBase=0
this.offsets=[]
this.targets=[]
this.scrollHeight=this.getScrollHeight()
if(!$.isWindow(this.$scrollElement[0])){
offsetMethod='position'
offsetBase=this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function (){
var $el=$(this)
var href=$el.data('target')||$el.attr('href')
var $href=/^#./.test(href)&&$(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]])||null
})
.sort(function (a, b){ return a[0] - b[0] })
.each(function (){
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process=function (){
var scrollTop=this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight=this.getScrollHeight()
var maxScroll=this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets=this.offsets
var targets=this.targets
var activeTarget=this.activeTarget
var i
if(this.scrollHeight!=scrollHeight){
this.refresh()
}
if(scrollTop >=maxScroll){
return activeTarget!=(i=targets[targets.length - 1])&&this.activate(i)
}
if(activeTarget&&scrollTop < offsets[0]){
this.activeTarget=null
return this.clear()
}
for (i=offsets.length; i--;){
activeTarget!=targets[i]
&& scrollTop >=offsets[i]
&& (offsets[i + 1]===undefined||scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}}
ScrollSpy.prototype.activate=function (target){
this.activeTarget=target
this.clear()
var selector=this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active=$(selector)
.parents('li')
.addClass('active')
if(active.parent('.dropdown-menu').length){
active=active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear=function (){
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.scrollspy')
var options=typeof option=='object'&&option
if(!data) $this.data('bs.scrollspy', (data=new ScrollSpy(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.scrollspy
$.fn.scrollspy=Plugin
$.fn.scrollspy.Constructor=ScrollSpy
$.fn.scrollspy.noConflict=function (){
$.fn.scrollspy=old
return this
}
$(window).on('load.bs.scrollspy.data-api', function (){
$('[data-spy="scroll"]').each(function (){
var $spy=$(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
+function ($){
'use strict';
var Tab=function (element){
this.element=$(element)
}
Tab.VERSION='3.3.4'
Tab.TRANSITION_DURATION=150
Tab.prototype.show=function (){
var $this=this.element
var $ul=$this.closest('ul:not(.dropdown-menu)')
var selector=$this.data('target')
if(!selector){
selector=$this.attr('href')
selector=selector&&selector.replace(/.*(?=#[^\s]*$)/, '')
}
if($this.parent('li').hasClass('active')) return
var $previous=$ul.find('.active:last a')
var hideEvent=$.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent=$.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if(showEvent.isDefaultPrevented()||hideEvent.isDefaultPrevented()) return
var $target=$(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function (){
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate=function (element, container, callback){
var $active=container.find('> .active')
var transition=callback
&& $.support.transition
&& (($active.length&&$active.hasClass('fade'))||!!container.find('> .fade').length)
function next(){
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if(transition){
element[0].offsetWidth
element.addClass('in')
}else{
element.removeClass('fade')
}
if(element.parent('.dropdown-menu').length){
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback&&callback()
}
$active.length&&transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.tab')
if(!data) $this.data('bs.tab', (data=new Tab(this)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.tab
$.fn.tab=Plugin
$.fn.tab.Constructor=Tab
$.fn.tab.noConflict=function (){
$.fn.tab=old
return this
}
var clickHandler=function (e){
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
+function ($){
'use strict';
var Affix=function (element, options){
this.options=$.extend({}, Affix.DEFAULTS, options)
this.$target=$(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element=$(element)
this.affixed=null
this.unpin=null
this.pinnedOffset=null
this.checkPosition()
}
Affix.VERSION='3.3.4'
Affix.RESET='affix affix-top affix-bottom'
Affix.DEFAULTS={
offset: 0,
target: window
}
Affix.prototype.getState=function (scrollHeight, height, offsetTop, offsetBottom){
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
var targetHeight=this.$target.height()
if(offsetTop!=null&&this.affixed=='top') return scrollTop < offsetTop ? 'top':false
if(this.affixed=='bottom'){
if(offsetTop!=null) return (scrollTop + this.unpin <=position.top) ? false:'bottom'
return (scrollTop + targetHeight <=scrollHeight - offsetBottom) ? false:'bottom'
}
var initializing=this.affixed==null
var colliderTop=initializing ? scrollTop:position.top
var colliderHeight=initializing ? targetHeight:height
if(offsetTop!=null&&scrollTop <=offsetTop) return 'top'
if(offsetBottom!=null&&(colliderTop + colliderHeight >=scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset=function (){
if(this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
return (this.pinnedOffset=position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop=function (){
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition=function (){
if(!this.$element.is(':visible')) return
var height=this.$element.height()
var offset=this.options.offset
var offsetTop=offset.top
var offsetBottom=offset.bottom
var scrollHeight=$(document.body).height()
if(typeof offset!='object') offsetBottom=offsetTop=offset
if(typeof offsetTop=='function') offsetTop=offset.top(this.$element)
if(typeof offsetBottom=='function') offsetBottom=offset.bottom(this.$element)
var affix=this.getState(scrollHeight, height, offsetTop, offsetBottom)
if(this.affixed!=affix){
if(this.unpin!=null) this.$element.css('top', '')
var affixType='affix' + (affix ? '-' + affix:'')
var e=$.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if(e.isDefaultPrevented()) return
this.affixed=affix
this.unpin=affix=='bottom' ? this.getPinnedOffset():null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if(affix=='bottom'){
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}}
function Plugin(option){
return this.each(function (){
var $this=$(this)
var data=$this.data('bs.affix')
var options=typeof option=='object'&&option
if(!data) $this.data('bs.affix', (data=new Affix(this, options)))
if(typeof option=='string') data[option]()
})
}
var old=$.fn.affix
$.fn.affix=Plugin
$.fn.affix.Constructor=Affix
$.fn.affix.noConflict=function (){
$.fn.affix=old
return this
}
$(window).on('load', function (){
$('[data-spy="affix"]').each(function (){
var $spy=$(this)
var data=$spy.data()
data.offset=data.offset||{}
if(data.offsetBottom!=null) data.offset.bottom=data.offsetBottom
if(data.offsetTop!=null) data.offset.top=data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
jQuery(document).ready(function($){
$('.navbar .dropdown > a, .dropdown-menu > li > a').click(function (){
location.href=this.href;
});
});
jQuery(document).ready(function($){
$("#back-top").hide();
$(function (){
$(window).scroll(function (){
if($(this).scrollTop() > 100){
$('#back-top').fadeIn();
}else{
$('#back-top').fadeOut();
}});
$('#back-top a').click(function (){
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
});
jQuery(document).ready(function($){
$(function (){
$('[data-toggle="tooltip"]').tooltip()
})
});
jQuery(document).ready(function($){
$('body').on('added_to_wishlist', function (){
$('.top-wishlist .count').load(yith_wcwl_l10n.ajax_url + ' .top-wishlist span', { action: 'yith_wcwl_update_single_product_list' });
});
});